package com.ithuameng.admin.app.system.model.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * AdminPageReqVo
 *
 * @author ithuameng
 */
@Data
public class AdminPageReqVo implements Serializable {

    private static final long serialVersionUID = -3346563880099173359L;

    @ApiModelProperty(value = "当前页码")
    private int pageNumber = 1;

    @ApiModelProperty(value = "每页记录数")
    private int pageSize = 10;

    @ApiModelProperty(value = "排序字段")
    private String sort;

    @ApiModelProperty(value = "排序方式 asc/desc")
    private String order;

    public boolean hasOrder() {
        return StringUtils.isNotBlank(sort) && StringUtils.isNotBlank(order);
    }

    public boolean orderAsc() {
        return "ASC".equals(this.order.toUpperCase());
    }
}
